home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 802 b | 40 lines | [TEXT/CWIE] |
- // FiniteQueueBase.h
-
- #ifndef FiniteQueueBase_h
- #define FiniteQueueBase_h
-
- #ifndef Integers_h
- #include "Integers.h"
- #endif
-
- class FiniteQueueBase
- {
- private:
- uint8 *const start;
- uint8 *const end;
- const uint32 elementSize;
- const uint32 length;
-
- uint8 *allocateNext;
- uint8 *disposeNext;
- uint32 allocated;
-
- // not implemented:
- FiniteQueueBase( const FiniteQueueBase& );
- void operator=( const FiniteQueueBase& );
-
- public:
- FiniteQueueBase( void *theSpace, uint32 length, uint32 elementSize );
-
- bool Full() const { return allocated >= length; }
- bool IsEmpty() const { return allocated == 0; }
-
- void *Allocate( uint32 size );
- void Release( void * );
- };
-
- inline void *operator new( uint32 size, FiniteQueueBase& pool )
- { return pool.Allocate( size ); }
-
- #endif
-